<%@page import="com.ignou.mca.datasource.DatabaseOperations"%>
<%@page import="com.ignou.mca.beans.ExamBean"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="com.ignou.mca.beans.UserVO"%><html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="theme/style.css"
	media="screen" />
<title>OES - Enroll for Exam</title>
</head>
<body onload="userfocus()">
	<div id="MainWrapper">
		<jsp:include page="header.jsp" /> 
		<jsp:include page="LeftContainer.jsp" />
		<div id="MainContent">
		<%
			UserVO uvo = (UserVO) session.getAttribute("UserVO");
			if(uvo==null)
			{
				response.sendRedirect("./Login.jsp");
			}
			else
			{
				String exam = request.getParameter("exam");
				int examID = Integer.parseInt(exam);
				ArrayList<ExamBean> exams = (ArrayList<ExamBean>) session.getAttribute("Exam");
				if(exams.size()>0)
				{
					%>
					<center>
						<h2>Enrolling for Exam</h2>
					<form action="ExamEnrollment.do" method="post">
						<table>
						<%
						for(int i=0;i<exams.size();i++)
						{
							ExamBean eb = exams.get(i);
							if(eb.getExamId()==examID)
							{
								%>
								<input type='hidden' name='subjectId' value='<%=eb.getSubjectId() %>'/>
								<tr><td>Exam Id</td><td><input type='hidden' name='examId' value='<%=eb.getExamId() %>'/><%=eb.getExamId() %></td></tr>
								<tr><td>Exam Name</td><td><input type='hidden' name='examName' value='<%=eb.getExamName() %>'/><%=eb.getExamName() %></td></tr>
								<tr><td>Exam Fees</td><td><input type='hidden' name='examFees' value='<%=eb.getExamFees() %>'/><%=eb.getExamFees() %></td></tr>
								<tr><td>Exam Duration</td><td><input type='hidden' name='examDuration' value='<%=eb.getDuration() %>'/><%=eb.getDuration() %></td></tr>
								<tr><td></td><td><input type="submit" name="submit" value="Enroll"/></td></tr>
								<%
							}else
							{
								%>
								<font color="red"> No exam available with Id=<%=eb.getExamId() %>.</font>
								<%
							}
						}
						%>
						</table>
					</form></center>
					<%
				}
			}
		%>
		</div>
		<jsp:include page="footer.jsp" />
	</div>
</body>
</html>